from flask import Blueprint, request
from ..Service.misc_s import MiscService
import json
from lib.util.log import Log
from lib.util.crypto import JWT

# from flasgger.utils import swag_from

misc = Blueprint('misc',__name__)
__ms = MiscService()

@misc.route('/get/fp/type/list', methods=['GET'])
def get_fp_type_list():
    return __ms.get_fp_type_list()
@misc.route('/get/sub/type/list', methods=['GET'])
def get_sub_type_list():
    return __ms.get_sub_type_list(**request.args.to_dict())

# @misc.route('/generate/video', methods=['POST'])
# # @swag_from('generate_video.yml')
# def generate_video():
#     return __ms.generate_video(**request.get_json())
# @misc.route('/video/address/<video_id>/<is_prev>/<mp3_path>', methods=['POST'])
# def setVideoAddress(video_id, is_prev, mp3_path):
#     args = json.loads(request.get_data())
#     return __ms.setVideoUrl(video_id, is_prev.lower() == 'true', mp3_path, **args)
# @misc.route('/get/video', methods=['GET'])
# def get_video():
#     return __ms.get_video(**request.args.to_dict())
# @misc.route('/get/prev/video', methods=['GET'])
# def get_prev_video():
#     return __ms.get_prev_video(**request.args.to_dict())



@misc.route('/test', methods=['POST','GET'])
@JWT.auth.login_required
def test():
    print(1111)
    if request.method == 'GET': return __ms.test(**request.args.to_dict())
    elif request.method == 'POST': return __ms.test(**request.get_json())
    # return __ms.test(**request.get_json())


